﻿namespace OrderSystem.Core.Domain
{
    public class Customer : BaseEntity
    {
        public virtual string Name { get; set; }
        public virtual string Phone { get; set; }
        public virtual string Address { get; set; }
        public virtual string Tag { get; set; }

        public override string ToString()
        {
            return string.Format("Id = {0} Name = {1}", Id, Name);
        }

        public override int GetHashCode()
        {
            return string.Format("{0}{1}{2}{3}{4}{5}", GetType().Name, Id, Name, Phone, Address, Tag).GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var customer = obj as Customer;

            if (customer == null) return false;

            return customer.GetHashCode() == GetHashCode();
        }
    }
}
